import { echartsStyle, constValue } from '@/config/echartsStyle'
import _ from 'lodash'

export const singleBarOption = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'none',
    },
  },
  backgroundColor: echartsStyle.backgroundColor,
  legend: echartsStyle.legend,
  grid: echartsStyle.grid,
  xAxis: _.assign({ type: 'category' }, echartsStyle.xAxisObj),
  yAxis: [
    _.assign(
      {
        type: 'value',
        show: false,
        position: 'left',
        splitNumber: constValue.splitNumber,
      },
      echartsStyle.yAxisObj
    ),
  ],
  series: [
    _.assign(
      {
        type: 'bar',
      },
      echartsStyle.seriesBarObj('#A3E083', '#48D3A9')
    ),
  ],
}

export const barOption = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'none',
    },
  },
  backgroundColor: echartsStyle.backgroundColor,
  legend: echartsStyle.legend,
  grid: echartsStyle.grid,
  xAxis: _.assign({ type: 'category' }, echartsStyle.xAxisObj),
  yAxis: [
    _.assign(
      {
        type: 'value',
        show: false,
        position: 'left',
        splitNumber: constValue.splitNumber,
      },
      echartsStyle.yAxisObj
    ),
  ],
  series: [
    _.assign(
      {
        type: 'bar',
      },
      echartsStyle.seriesBarObj('#62DCB8', '#62DCB8')
    ),
    _.assign(
      {
        type: 'bar',
      },
      echartsStyle.seriesBarObj('#21C393', '#21C393')
    ),
  ],
}

export const bar_lineOption = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'none',
    },
  },
  backgroundColor: echartsStyle.backgroundColor,
  legend: echartsStyle.legend,
  grid: echartsStyle.grid,
  xAxis: _.assign({ type: 'category' }, echartsStyle.xAxisObj),
  yAxis: [
    _.assign(
      {
        type: 'value',
        show: true,
        position: 'left',
        splitNumber: constValue.splitNumber,
      },
      echartsStyle.yAxisObj
    ),
    _.assign(
      {
        type: 'value',
        show: true,
        position: 'right',
        splitNumber: constValue.splitNumber,
      },
      echartsStyle.yAxisObj
    ),
  ],
  series: [
    _.assign(
      {
        type: 'bar',
      },
      echartsStyle.seriesBarObj('#A3E083', '#48D3A9')
    ),
    _.assign(
      {
        type: 'line',
      },
      echartsStyle.seriesLineObj('#1455FD', '#7D9EF4')
    ),
  ],
}

export const multiBar_lineOption = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'none',
    },
  },
  backgroundColor: echartsStyle.backgroundColor,
  legend: echartsStyle.legend,
  grid: echartsStyle.grid,
  xAxis: _.assign({ type: 'category' }, echartsStyle.xAxisObj),
  yAxis: [
    _.assign(
      {
        type: 'value',
        show: true,
        position: 'left',
        splitNumber: constValue.splitNumber,
      },
      echartsStyle.yAxisObj
    ),
    _.assign(
      {
        type: 'value',
        show: true,
        position: 'right',
        splitNumber: constValue.splitNumber,
      },
      echartsStyle.yAxisObj
    ),
  ],
  series: [
    _.assign(
      {
        type: 'bar',
      },
      echartsStyle.seriesBarObj('#A3E083', '#48D3A9')
    ),
    _.assign(
      {
        type: 'bar',
      },
      echartsStyle.seriesBarObj('#21C393', '#21C393')
    ),
    _.assign(
      {
        type: 'line',
      },
      echartsStyle.seriesLineObj('#1455FD', '#7D9EF4')
    ),
    _.assign(echartsStyle.seriesLineObj('#7B68EE', '#7D9EF4'), {
      type: 'line',
      itemStyle: {
        color: '#7B68EE',
        borderColor: '#fff',
        borderWidth: 3,
      },
    }),
  ],
}
